# Copyright(c) 2019, 九哥BIMer
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

b = IN[0]
a = []
for x in range (0, len(b)):
    line = UnwrapElement(b[x]).GeometryCurve

ref = ReferenecArray()
ref.Append(line.GetEndPointReference(0))
ref.Append(line.GetEndPointReference(1))

TransactionManager.Instance.EnsureInTransaction(doc)

dim = doc.Create.NewDimension(doc.ActiveView,line,ref)

TransactionManager.Instance.TransactionTaksDone()
d = dim
a.extend([d])
OUT = a

